﻿<%@ Page Language="C#" MasterPageFile="~/Member.Master" AutoEventWireup="true" CodeBehind="Login.aspx.cs"
    Inherits="Continental.UI.Member.Login" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">

    <script language="javascript" type="text/javascript">
        var isEmail = true;
        var isPassword = true;
        var message = "";
		$(document).ready(function(){    
            $("#<%=txtEmail2.ClientID%>").blur(function() {
                var email = $("#<%=txtEmail2.ClientID%>").val().trim();
                if (email == "")
                {   
                    $("#sEmail").hide();
                    isEmail = false;
                    return;
                }
                else
                {
                    $.ajax({
                        type: "POST",
                        url: "/WS.asmx/EmailExits",
                        data: "{email:'" + email +"'}", 
                        contentType: "application/json; charset=utf-8", 
                        dataType: "json",
                        success: function(result) {
                            if(result.d)
                            {
                                $("#sEmail2").text("");
                                $("#sEmail2").hide();
                                isEmail = false;
                            }
                            else
                            {
                                $("#sEmail2").html("Email không tồn tại trong hệ thống"); 
                                $("#sEmail2").show();
                                isEmail = true;
                            }
                        }
                    });
                }
            });
            
            $("#<%=txtPassword.ClientID%>").blur(function() {
                var password = $("#<%=txtPassword.ClientID%>").val().trim();
                if (password == "")
                {
                    $("#sPassword").hide();
                    isPassword = false;
                    return;
                }
                if (password.length > 10 || password.length < 6)
                {
                    $("#sPassword").text("Mật khẩu phải có 6->10 kí tự");
                    $("#sPassword").show();
                    isPassword = false; 
                }
                else
                {
                    $("#sPassword").text("");
                    $("#sPassword").hide();
                    isPassword = true;
                }
            });
		});
    </script>

</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <div class="box_container" style="width: 650px; margin-top: 10px;">
        <div class="title_bar">
            <div>
                Đăng nhập</div>
        </div>
        <div style="padding-left: 10px; padding-right: 10px; color: #7A2C01" class="popup_Body">
            <table class="list" cellpadding="0" cellspacing="0">
                <tbody>
                    <td colspan="2">
                        <span style="color: Red;">
                            <%= message%>
                        </span>
                    </td>
                    <tr>
                        <td>
                            <span>Email : </span>
                        </td>
                        <td>
                            <asp:TextBox ID="txtEmail" CssClass="txt_s" runat="server" MaxLength="100"></asp:TextBox>
                            <asp:RequiredFieldValidator ID="rfvEmail" ControlToValidate="txtEmail" runat="server"
                                ValidationGroup="Login" ErrorMessage="*"></asp:RequiredFieldValidator>
                            <asp:RegularExpressionValidator ID="revEmail" ControlToValidate="txtEmail" runat="server"
                                ValidationGroup="Login" ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"
                                ErrorMessage="Email không hợp lệ"></asp:RegularExpressionValidator>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <span>Mật khẩu : </span>
                        </td>
                        <td>
                            <asp:TextBox ID="txtPassword" CssClass="txt_s" TextMode="Password" MaxLength="15"
                                runat="server"></asp:TextBox>
                            <span id="sPassword" visible="false" class="error"></span>
                            <asp:RequiredFieldValidator ID="rfvPassword" ControlToValidate="txtPassword" runat="server"
                                ValidationGroup="Login" ErrorMessage="*"></asp:RequiredFieldValidator>
                        </td>
                    </tr>
                    <tr>
                        <td>
                        </td>
                        <td>
                            <asp:CheckBox ID="ckRemember" runat="server" Text="Nhớ mật khẩu" />
                        </td>
                    </tr>
                    <tr>
                        <td>
                        </td>
                        <td>
                            <asp:Button ID="btnLogin" CssClass="search_btn blue" ValidationGroup="Login" Width="100px"
                                runat="server" Text="Đăng nhập" OnClick="btnLogin_Click" />
                        </td>
                    </tr>
                </tbody>
            </table>
        </div>
    </div>
    <div class="box_container" style="width: 650px; margin-top: 10px;">
        <div class="title_bar">
            <div>
                Quên mật khẩu</div>
        </div>
        <div style="padding-left: 10px; padding-right: 10px; color: #7A2C01" class="popup_Body">
            <span style="display: inline-block; width: 500px; color: Red;">
                <%= message2 %>
            </span>
            <table class="list" cellpadding="0" cellspacing="0">
                <tbody>
                    <tr>
                        <td>
                            <span>Email : </span>
                        </td>
                        <td>
                            <asp:TextBox ID="txtEmail2" CssClass="txt_s" runat="server"></asp:TextBox>
                            <span id="sEmail2" visible="false" class="error"></span>
                            <asp:RequiredFieldValidator ID="rfvEmail2" ControlToValidate="txtEmail2" runat="server"
                                ValidationGroup="ForgetPwd" ErrorMessage="*"></asp:RequiredFieldValidator>
                            <asp:RegularExpressionValidator ID="revEmail2" ControlToValidate="txtEmail2" runat="server"
                                ValidationGroup="ForgetPwd" ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"
                                ErrorMessage="Email không hợp lệ"></asp:RegularExpressionValidator>
                        </td>
                    </tr>
                    <tr>
                        <td>
                        </td>
                        <td>
                            <asp:Button ID="btnForgetPWD" runat="server" Text="Gửi" Width="70px" CssClass="search_btn blue"
                                ValidationGroup="ForgetPwd" OnClick="btnForgetPWD_Click" />
                        </td>
                    </tr>
                </tbody>
            </table>
        </div>
    </div>
</asp:Content>
